package com.ccys.doctor.controller;

import com.ccys.common.constants.TouristApi;
import com.ccys.common.vo.ResponseResultApp;
import com.ccys.db.dto.doctor.login.DoctorLoginDto;
import com.ccys.db.vo.doctor.login.ClinicListByDoctorVo;
import com.ccys.doctor.service.DoctorPcLoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @program: WhiteCoat
 * @description: 登录相关接口
 * @author: ZhangJingCan
 * @create: 2024-02-05 09:29
 **/
@RestController
@Api(tags = "登录相关接口")
@RequestMapping("doctorPcLogin")
public class DoctorPcLoginController {

    @Autowired
    private DoctorPcLoginService doctorPcLoginService;

    /**
     *
     * @param patientCountryOfResidence 患者所在国家
     * @param doctorCountryOfResidence 医生所在国家
     * @return
     */
    @ApiOperation("获取等待审批的数量")
    @GetMapping(value = "/GetCountOfWaitingApproval")
    public ResponseResultApp getCountOfWaitingApproval(String patientCountryOfResidence, String doctorCountryOfResidence) {
        return doctorPcLoginService.getCountOfWaitingApproval(patientCountryOfResidence, doctorCountryOfResidence);
    }

    /**
     *
     * @param clinic_id 选择的诊所id
     * @return
     */
    @ApiOperation("更新医生所在诊所")//触发时间：医生登录之后选择某个诊所的动作
    @PostMapping(value = "/UpdateClinic")//注意 - 对方postman写的为：post请求，但是参数放在Params中，这里不加@RequestBody
    public ResponseResultApp updateClinic(String clinic_id) {
        return doctorPcLoginService.updateClinic(clinic_id);
    }

    @ApiOperation("获取医生可用的诊所列表")//触发时间：医生登录之后,提供诊所列表选择当前所在诊所
    @GetMapping(value = "/GetClinicByDoctor")
    public ResponseResultApp<List<ClinicListByDoctorVo>> getClinicByDoctor() {
        return doctorPcLoginService.getClinicByDoctor();
    }

    @TouristApi
    @ApiOperation("医生登录")//触发时间：医生登录页面
    @PostMapping(value = "/Login")
    public Object login(DoctorLoginDto dto) {
        return doctorPcLoginService.login(dto);
    }

}
